package mysql;


import java.sql.*;
import java.util.Random;


public class circle {
	
	static String insertsql = "insert into list values(?,?,?,?,?)";
	
	public static void main(String[] args)
	{
	     try {
	          Class.forName("com.mysql.cj.jdbc.Driver");     //加载MYSQL JDBC驱动程序   
	          //Class.forName("org.gjt.mm.mysql.Driver");
	         System.out.println("Success loading Mysql Driver!");
	        }
	        catch (Exception e) {
	          System.out.print("Error loading Mysql Driver!");
	          e.printStackTrace();
	        }
	     
	     try {
	       Connection connect = DriverManager.getConnection(
	              "jdbc:mysql://172.16.63.135/test","root","000000");
	       PreparedStatement Statement=connect.prepareStatement(insertsql);
	       
	       int num=100000;
	       Random random=new Random();
	       String str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
	       StringBuffer sb=new StringBuffer();
	       int length=4;
	       for(int i=0;i<length;i++){

	   		int number=random.nextInt(62);

	   		sb.append(str.charAt(number));

	   		}
	       for(int i=0;i<num;)        //
	      {
	    	   
	           Statement.setInt(1,random.nextInt(1000000000));
	           Statement.setInt(2,random.nextInt(100000));
	           Statement.setInt(3,random.nextInt(1000000000));
	           Statement.setInt(4,random.nextInt(100000000));
	           Statement.setInt(5,random.nextInt(100000));
	           Statement.addBatch();
	           i++;
	           if(i%1000==0)
	           {
	        	   Statement.executeBatch();
	           }
	      }
	       System.out.print("插入成功！");
	  } 
	     
	     catch(SQLException e)
		   {
	    	 e.printStackTrace();
		   }
	 }

}
